package org.kineticsproject.visualizations;

import java.util.LinkedList;
import java.util.List;

public class Trace {
	
	 private List<Crumb>  crumbs;
	 private int          index;
	 
	public Trace() 
	{
	    crumbs 	= new LinkedList<Crumb>();
	    index 		= 0;
	 }
	  
	  public void add(Crumb newCrumb)
	  {
		  crumbs.add(newCrumb);
	  }
	  
	  public Crumb head()
	  {
		  index = 0;
		  return(crumbs.get(index));
	  }

	 public Crumb next()
	 {
		Crumb result = null;

		 if ((++index) < (crumbs.size()))
		 {
			 result = (Crumb)crumbs.get(index);
		 }
		 return(result);
	 }
}
